/*
 * @Description: 档案鉴定管理操作
 * @Author: Rfan
 * @Date: 2022-07-29 16:18:02
 * @LastEditTime: 2022-07-29 19:22:25
 */

import { useMemo, useState } from 'react';
import { Button, Divider, Space } from 'antd';
import cs from 'classnames';
import { useAppraisalMgtContext } from '../contexts/AppraisalMgtContext';
import AddDialog from './dialogs/AddDialog';

const PageOperate = (props: any) => {
  const { classname } = props;
  const { selectItems, deleteBatchFunc } = useAppraisalMgtContext();

  const [addVisible, setAddVisible] = useState(false);
  const delBatches = () => {
    deleteBatchFunc(selectItems, '确定删除选定的鉴定单？');
  };

  return (
    <>
      <div className={cs('filter-container', 'page-operate', classname)}>
        <p>鉴定批次列表</p>
        <Space size="small">
          {/* <Button */}
          {/*  onClick={() => { */}
          {/*    setAppraisalVisible(true); */}
          {/*  }} */}
          {/* > */}
          {/*  提交鉴定 */}
          {/* </Button> */}
          <Button disabled>作废</Button>
          <Button disabled>鉴定处理</Button>
          <Button
            onClick={() => {
              delBatches();
            }}
          >
            删除
          </Button>
          <Button
            onClick={() => {
              setAddVisible(true);
            }}
          >
            新建鉴定单
          </Button>
          <Divider type="vertical" />
          <Button>筛选</Button>
        </Space>
      </div>
      {useMemo(
        () => (
          <AddDialog
            visible={addVisible}
            onClose={() => {
              setAddVisible(false);
            }}
          />
        ),
        [addVisible]
      )}
    </>
  );
};

export default PageOperate;
